package com.amdox.liugui.springbooteasyexcel.component;

import com.alibaba.excel.write.style.row.AbstractRowHeightStyleStrategy;
import org.apache.poi.ss.usermodel.Row;

/**
 * 设置表头的自动调整行高策略
 *
 * @author wb_gui_liu - 0078932 2025/06/10 20:34
 */

public class CellRowHeightStyleStrategy extends AbstractRowHeightStyleStrategy {

    @Override
    protected void setHeadColumnHeight(Row row, int relativeRowIndex) {
        //设置主标题行高为30
        if (relativeRowIndex == 0) {
            //如果excel需要显示行高为30，那这里就要设置为30*20=600
            row.setHeight((short) (600));
        }
        if (relativeRowIndex == 1) {
            //如果excel需要显示行高为20，那这里就要设置为20*20=400
            row.setHeight((short) (400));
        }
    }

    @Override
    protected void setContentColumnHeight(Row row, int relativeRowIndex) {
    }
}